<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="member.MemberProc"%>
<%@page import="comm.util.SoptHashMap"%>
<%@page import="comm.util.CommUtil"%>
<%@page import="statics.SoptVars"%>
<%@page import="java.util.ArrayList"%>

<div>
	<%if(session.isNew() || session.getAttribute("SESSION_MEMBER_SEQ")==null){ %>
		<script type="text/javascript">
			alarm("로그인 후 이용하실 수 있습니다.");
		</script>
	<%}else{
		MemberProc infoMem = new MemberProc();
		SoptHashMap memHm = infoMem.getMemberInfoBySeq(session.getAttribute("SESSION_MEMBER_SEQ").toString());
		String opens[] = memHm.get("MEMBER_OPEN").toString().split(" ");
		int j = 0;
		String checked = "checked='checked'";
	%>  
		<h2>내정보 수정</h2>
		<form action="jsp/updateMemberProc.jsp" target="ifr" method="post" onsubmit="return checkUpdateMember();">
			Email: <input type="text" disabled="disabled" value="<%=session.getAttribute("SESSION_MEMBER_EMAIL") %>">
			<br>
			Nick: <input type="text" name="nick" id="nick" value="<%=CommUtil.NVL(memHm.get("MEMBER_NICK"),"") %>">
			<br>
			Homepage: http://<input type="text" name="blog" id="blog" value="<%=CommUtil.NVL(memHm.get("MEMBER_HOMEPAGE"),"") %>">
			<input type="radio" name="blog_open" value="1" id="blog_open" <%=opens[j].equals("1")?checked:""%>>
			<label for="blog_open">공개</label>
			<input type="radio" name="blog_open"  value="0" id="blog_close" <%=opens[j++].equals("0")?checked:""%>>
			<label for="blog_close">비공개</label>
			<br>
			Mobile: <input type="text" name="mobile" id="mobile" value="<%=CommUtil.NVL(memHm.get("MEMBER_PHONE"),"") %>">
			<input type="radio" name="mobile_open" value="1" id="mobile_open" <%=opens[j].equals("1")?checked:""%>>
			<label for="mobile_open">공개</label>
			<input type="radio" name="mobile_open" value="0" id="mobile_close" <%=opens[j++].equals("0")?checked:""%>>
			<label for="mobile_close">비공개</label>
			<br>
			<%
				String twitterId = CommUtil.NVL(memHm.get("MEMBER_TWITTER_ID"),"");
			%>
			twitter: <input type="text" value="<%=twitterId%>" disabled="disabled">
			<%if(twitterId.length()==0){ %>
			<input type="button" value="트위터 연동하기" onclick="javascript:underWorking();">
			<%}else{ %>
			<input type="button" value="트위터 연동 해지하기">
			<%} %>
			<input type="radio" name="twitter_open" value="1" id="twitter_open" <%=opens[j].equals("1")?checked:""%>>
			<label for="twitter_open">공개</label>
			<input type="radio" name="twitter_open" value="0" id="twitter_close" <%=opens[j++].equals("0")?checked:""%>>
			<label for="twitter_close">비공개</label>
			<br>
			<%
				String me2Id = CommUtil.NVL(memHm.get("MEMBER_ME2DAY_ID"),"");
			%>
			me2day: <input type="text" value="<%=me2Id%>" disabled="disabled">
			<%if(me2Id.length()==0){ %>
			<input type="button" value="미투데이 연동하기" onclick="javascript:underWorking();">
			<%}else{ %>
			<input type="button" value="미투데이 연동 해지하기">
			<%} %>
			<input type="radio" name="me2day_open" value="1" id="me2day_open" <%=opens[j].equals("1")?checked:""%>>
			<label for="me2day_open">공개</label>
			<input type="radio" name="me2day_open" value="0" id="me2day_close" <%=opens[j++].equals("0")?checked:""%>>
			<label for="me2day_close">비공개</label>
			<br>
			Introduce: <textarea name="introduce"><%=CommUtil.NVL(memHm.get("MEMBER_INTRO"),"") %></textarea>
			<input type="radio" name="introduce_open" value="1" id="introduce_open" <%=opens[j].equals("1")?checked:""%>>
			<label for="introduce_open">공개</label>
			<input type="radio" name="introduce_open" value="0" id="introduce_close" <%=opens[j++].equals("0")?checked:""%>>
			<label for="introduce_close">비공개</label>
			<br>
			<input type="submit" value="저장" id="btnUpdateMember">
		</form>
		<h2>프로필 이미지 수정</h2>
		<div>
			Pic:
			<div>
				<%if(memHm.get("MEMBER_PIC_URL")==null){ %>
				<span id="notImageSpan">이미지 없음</span>
				<img src="" id="memPic" style="display: none;" width="<%=SoptVars.IMG_WIDTH %>" height="<%=SoptVars.IMG_HEIGHT %>"/>
				<%}else{ %>
				<img src="data/<%=memHm.get("MEMBER_PIC_URL")%>" id="memPic" width="<%=SoptVars.IMG_WIDTH %>" height="<%=SoptVars.IMG_HEIGHT %>"/>
				<%} %>
			<form action="jsp/picUpdate.jsp" method="post" enctype="multipart/form-data" id="picForm" name="picForm" target="ifr">
				<input type="file" name="img_file" id="img_file">
				<p>jpg,gif만 가능!</p>
				<input type="button" value="이미지 업로드" onclick="javascript:doImgUpload();">
			</form>
			</div>
		</div>
	<%} %>
</div>